import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkShopVO, ParkShopForm, ParkShopQuery } from '@/api/park/parkShop/types';
/**
 * 查询店铺列表
 * @param query
 * @returns {*}
 */

export const listParkShop = (query?: ParkShopQuery): AxiosPromise<ParkShopVO[]> => {
  return request({
    url: '/park/parkShop/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询店铺详细
 * @param shopId
 */
export const getParkShop = (shopId: string | number): AxiosPromise<ParkShopVO> => {
  return request({
    url: '/park/parkShop/' + shopId,
    method: 'get'
  });
};

/**
 * 新增店铺
 * @param data
 */
export const addParkShop = (data: ParkShopForm) => {
  return request({
    url: '/park/parkShop',
    method: 'post',
    data: data
  });
};

/**
 * 修改店铺
 * @param data
 */
export const updateParkShop = (data: ParkShopForm) => {
  return request({
    url: '/park/parkShop',
    method: 'put',
    data: data
  });
};

/**
 * 删除店铺
 * @param shopId
 */
export const delParkShop = (shopId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkShop/' + shopId,
    method: 'delete'
  });
};

/**
 * 状态修改
 * @param shopId
 * @param status
 */
export const changeStatus = (shopId: number | string, status: string) => {
  const data = {
    shopId,
    status
  };
  return request({
    url: '/park/parkShop/changeStatus',
    method: 'put',
    data: data
  });
};


export const optionShop = (query: ParkShopForm): AxiosPromise<ParkShopVO[]> => {
  return request({
    url: '/park/parkShop/option',
    method: 'get',
    params: query
  });
};
